<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>函数参数默认值</title>
</head>
<body>
    
</body>
<script>
    //函数参数可以设置默认值，并且通常把默认值放在最后，避免影响参数传递。
    let fn1 = function(a,b,c=55){
        console.log(a+b+c);
    }
    fn1(13,14);
    //能与解构赋值一起使用。
    let fn2 = function({usernaem,passowd,host=`127.0.0.1`}){
        console.log(`${usernaem},${passowd},${host}`);
    };
    var connect ={
        usernaem:`root`,
        passowd:`root`,
        host:`localhost`,
    }
    fn2(connect);
</script>
</html>